ExamPlay Light Logo
Zalogować się

Computer Science for IGCSE & O level - Programming (Section 3 - No. 16)

What is the main difference between a local and a global variable?
Local variables can be used anywhere in the program, and global variables can only be used in a single function.
Global variables are only for numbers, and local variables are for text.
Local variables are declared inside a function, and global variables are declared outside any function.
Local variables are more efficient than global variables.

Wyjaśnienie

The key difference is their scope - where they can be accessed in the code.

Uwagi (0)

Zaloguj się, aby skomentować
Reklama
BrainBehindX Inc Logo
©2026; Obsługiwane przez BrainBehindX Inc